import 'dart:async';
import 'dart:typed_data';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class FlutterCos {
  static const MethodChannel _channel =
      const MethodChannel('tencent_cos_flutter');


  static Future<String?> upload({
    required String path,
    required String cosUrl,
    required String bucket,
    required String tmpSecretId,
    required String tmpSecretKey,
    required String sessionToken,
    required String region,
    required String startTime,
    required String expiredTime,
  }) async {
    final String? urlStr = await _channel.invokeMethod('upload', {
      'path': path,
      'cosUrl': cosUrl,
      'bucket': bucket,
      'tmpSecretId': tmpSecretId,
      'tmpSecretKey': tmpSecretKey,
      'sessionToken': sessionToken,
      'region': region,
      'startTime': startTime,
      'expiredTime': expiredTime,
    });

    return urlStr;
  }

  static Future<String?> uploadTest({
    required String testurl,
  }) async {
    final String? urlStr = await _channel.invokeMethod('uploadTest', {
      'testurl': testurl,
    });
    return urlStr;
  }
}
